<template>
  <div style="margin:10px 0">
    <div style="margin:10px 0">
      <el-input v-model="name" placeholder="请输入姓名" style="width: 100px; margin:0 5px 5px 0"/>
      <el-input v-model="account" placeholder="请输入学号" style="width: 100px; margin:0 5px 5px 0"/>
      <el-button @click="load" style="margin:0 5px 5px 0" type="primary">
        <el-icon style="vertical-align: middle">
          <Search />
        </el-icon>
        <span style="vertical-align: middle"> 搜索 </span>
      </el-button>
      <el-button @click="reset" style="margin:0 50px 5px 0" type="warning">
        <el-icon style="vertical-align: middle">
          <RefreshLeft />
        </el-icon>
        <span style="vertical-align: middle"> 重置 </span>
      </el-button>
    </div>
    <el-table :data="tableData" stripe border style="width: 100%">
      <el-table-column align="center" prop="id" label="序号"/>
      <el-table-column align="center" prop="examDescribe" label="考试描述"/>
      <el-table-column align="center" prop="examData" label="考试日期"/>
      <el-table-column align="center" prop="subject" label="学科"/>
      <el-table-column align="center" prop="classes" label="班级"/>
      <el-table-column align="center" prop="account" label="学号"/>
      <el-table-column align="center" prop="name" label="姓名"/>
      <el-table-column align="center" prop="totalScore" label="成绩"/>
      <el-table-column align="center" prop="classesRanking" label="班级排名"/>
      <el-table-column align="center" prop="schoolRanking" label="学校排名"/>
      <el-table-column align="center" prop="tListening" label="听力"/>
      <el-table-column align="center" prop="tReading" label="阅读理解"/>
      <el-table-column align="center" prop="tLanguageKnowledgeApplication" label="语言知识引用"/>
      <el-table-column align="center" prop="tWriting" label="写作"/>
      <el-table-column align="center" label="操作" width="180px">
        <template #default="scope">
          <el-button @click="handleEdit(scope.row)" type="primary">编辑</el-button>
          <el-popconfirm
              style="margin: 5px"
              confirm-button-text='确定'
              cancel-button-text='算了'
              title="您确定删除吗？"
              @confirm="del(scope.row.id)"
          >
            <template #reference>
              <el-button type="danger">删除 <i class="el-icon-remove-outline"></i></el-button>
            </template>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
    <div style="margin:10px 0">
      <el-pagination
          v-model:current-page="pageNum"
          v-model:page-size="pageSize"
          :page-sizes="[2, 5, 10, 20,50]"
          large
          layout="total, sizes,prev,pager,next,jumper"
          :total="total"
      />
    </div>
    <el-dialog title="学生信息"  v-model="dialogFormVisible" width="20%" >
      <el-form label-width="80px">
        <el-form-item label="学号">
          <el-input v-model="form.stu_Num" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="姓名">
          <el-input v-model="form.stu_Name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="年级">
          <el-input v-model="form.grade" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="班级">
          <el-input v-model="form.class" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="入学时间">
          <el-input v-model="form.enrolled_time" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="form.phone" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="家庭地址">
          <el-input v-model="form.address" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="save">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {Search, RefreshLeft,} from '@element-plus/icons-vue'
export default {
  name: "english_score",
  components:{
    Search,
    RefreshLeft,
  },
  data(){
    return{
      pageNum:1,
      pageSize:10,
      total:50,
      name:'',
      account:'',
      classes:JSON.parse(localStorage.getItem('userInfo')).classes,
      dialogFormVisible: false,
      form:{},
      tableData:[
        {id:'02125',examDescribe:'高三5月第二次模考成绩',examData:'2022-05-02',subject:'英语',classes:'2',account:'2019090121',name:'张三',totalScore:'101',
          classesRanking:'27',schoolRanking:'354',tListening:'42',tReading:'12',tLanguageKnowledgeApplication:'20',tWriting:'34'},
        {id:'02124',examDescribe:'高三5月第二次模考成绩',examData:'2022-05-02',subject:'英语',classes:'2',account:'2019090111',name:'李二',totalScore:'98',
          classesRanking:'24',schoolRanking:'275',tListening:'37',tReading:'10',tLanguageKnowledgeApplication:'18',tWriting:'30'},
        {id:'02123',examDescribe:'高三5月第二次模考成绩',examData:'2022-05-02',subject:'英语',classes:'2',account:'2019090135',name:'王五',totalScore:'91',
          classesRanking:'35',schoolRanking:'536',tListening:'41',tReading:'17',tLanguageKnowledgeApplication:'8',tWriting:'28'},
      ]
    }
  },
  created() {
    //this.load()    //调用load方法拿到后台数据
  },
  methods:{
    // 加载的接口
    // load(){
    //   service.get("/tb-english-score/english",{
    //     params:{
    //       pageNum: this.pageNum,
    //       pageSize: this.pageSize,
    //       name: this.name,
    //       account: this.account,
    //       classes: this.classes,
    //     }
    //   }).then(res=>{
    //     this.tableData=res.data.records
    //     this.total=res.data.total
    //   })
    // },
    reset() {
      this.name = ""
      this.account=""
      this.load()
    },
    handleEdit(row){
      this.form = row
      this.dialogFormVisible = true
    },
  },
}
</script>

<style scoped>

</style>
